package com.fzhucc.modules.expert.domain;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
* @description 专家预约表/
* @author yyg
* @date 2023-10-20
**/
@Entity
@Data
@Table(name="tt_expert_reservation")
public class ExpertReservation implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "`id`")
    @ApiModelProperty(value = "id")
    private Integer id;

    @Column(name = "`name`",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "预约人")
    private String name;

    @Column(name = "`unit`",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "单位/学校")
    private String unit;

    @Column(name = "`phone`",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "手机号")
    private String phone;

    @Column(name = "`expert_id`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "被预约专家id")
    private Integer expertId;

    @Column(name = "`day`")
    @ApiModelProperty(value = "日期")
    private String day;

    @Column(name = "`expert_consultation_id`")
    @ApiModelProperty(value = "关联线上预约配置id  不为空说明关联了 线上预约")
    private Integer expertConsultationId;

    @Column(name = "`expert_offline_id`")
    @ApiModelProperty(value = "关联线下辅导配置id  不为空说明关联了 线下辅导")
    private Integer expertOfflineId;

    @Column(name = "`type`",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "字典 专家预约类型 字典 expert_reservation_type")
    private String type;

    @Column(name = "`user_id`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "userid")
    private Long userId;

    public void copy(ExpertReservation source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
